load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

VERSION = "0.1.0"

rust_binary(
    name = "ic-boundary",
    srcs = glob(
        ["src/**"],
        exclude = ["src/lib.rs"],
    ),
    proc_macro_deps = [
        # Keep sorted.
        "@crate_index//:async-trait",
        "@crate_index//:derive-new",
    ],
    version = VERSION,
    deps = [
        # Keep sorted.
        "//packages/ic-ed25519",
        "//rs/boundary_node/rate_limits/api:rate_limits_api",
        "//rs/boundary_node/salt_sharing/api:salt_sharing_api",
        "//rs/certification/test-utils",
        "//rs/config",
        "//rs/crypto",
        "//rs/crypto/tree_hash",
        "//rs/crypto/utils/basic_sig",
        "//rs/crypto/utils/threshold_sig_der",
        "//rs/crypto/utils/tls",
        "//rs/interfaces",
        "//rs/interfaces/registry",
        "//rs/limits",
        "//rs/monitoring/logger",
        "//rs/orchestrator/registry_replicator",
        "//rs/protobuf",
        "//rs/registry/fake",
        "//rs/registry/helpers",
        "//rs/registry/keys",
        "//rs/registry/proto_data_provider",
        "//rs/registry/routing_table",
        "//rs/registry/subnet_type",
        "//rs/types/base_types",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:arc-swap",
        "@crate_index//:axum",
        "@crate_index//:axum-extra",
        "@crate_index//:bytes",
        "@crate_index//:candid",
        "@crate_index//:clap",
        "@crate_index//:dashmap",
        "@crate_index//:ethnum",
        "@crate_index//:futures",
        "@crate_index//:futures-util",
        "@crate_index//:hex",
        "@crate_index//:http",
        "@crate_index//:http-body",
        "@crate_index//:humantime",
        "@crate_index//:ic-agent",
        "@crate_index//:ic-bn-lib",
        "@crate_index//:ic-bn-lib-common",
        "@crate_index//:ipnet",
        "@crate_index//:lazy_static",
        "@crate_index//:little-loadshedder",
        "@crate_index//:maxminddb",
        "@crate_index//:mockall",
        "@crate_index//:moka",
        "@crate_index//:nftables",
        "@crate_index//:nix",
        "@crate_index//:rand",
        "@crate_index//:ratelimit",
        "@crate_index//:rcgen",
        "@crate_index//:regex",
        "@crate_index//:reqwest",
        "@crate_index//:rustls",
        "@crate_index//:rustls-pemfile",
        "@crate_index//:serde",
        "@crate_index//:serde_bytes",
        "@crate_index//:serde_cbor",
        "@crate_index//:serde_json",
        "@crate_index//:serde_regex",
        "@crate_index//:serde_yaml",
        "@crate_index//:sha3",
        "@crate_index//:simple_moving_average",
        "@crate_index//:slog",
        "@crate_index//:strum",
        "@crate_index//:thiserror",
        "@crate_index//:tikv-jemalloc-ctl",
        "@crate_index//:tikv-jemallocator",
        "@crate_index//:tokio",
        "@crate_index//:tokio-util",
        "@crate_index//:tower",
        "@crate_index//:tower-http",
        "@crate_index//:tower_governor",
        "@crate_index//:tracing",
        "@crate_index//:tracing-serde",
        "@crate_index//:tracing-slog",
        "@crate_index//:tracing-subscriber",
        "@crate_index//:url",
        "@crate_index//:x509-parser",
    ],
)

rust_test(
    name = "ic_boundary_test",
    crate = ":ic-boundary",
    data = [
        "//:pebble",
        "//:pebble-challtestsrv",
    ],
    env = {
        "PEBBLE": "$(rootpath //:pebble)",
        "CHALLTESTSRV": "$(rootpath //:pebble-challtestsrv)",
    },
    proc_macro_deps = [
        # Keep sorted.
        "@crate_index//:async-trait",
        "@crate_index//:derive-new",
        "@crate_index//:indoc",
    ],
    deps = [
        # Keep sorted.
        "//packages/ic-ed25519",
        "//rs/boundary_node/rate_limits/api:rate_limits_api",
        "//rs/boundary_node/salt_sharing/api:salt_sharing_api",
        "//rs/certification/test-utils",
        "//rs/config",
        "//rs/crypto",
        "//rs/crypto/tree_hash",
        "//rs/crypto/utils/basic_sig",
        "//rs/crypto/utils/threshold_sig_der",
        "//rs/crypto/utils/tls",
        "//rs/interfaces",
        "//rs/interfaces/registry",
        "//rs/limits",
        "//rs/monitoring/logger",
        "//rs/orchestrator/registry_replicator",
        "//rs/protobuf",
        "//rs/registry/fake",
        "//rs/registry/helpers",
        "//rs/registry/keys",
        "//rs/registry/proto_data_provider",
        "//rs/registry/routing_table",
        "//rs/registry/subnet_type",
        "//rs/types/base_types",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:arc-swap",
        "@crate_index//:axum",
        "@crate_index//:axum-extra",
        "@crate_index//:bytes",
        "@crate_index//:candid",
        "@crate_index//:clap",
        "@crate_index//:dashmap",
        "@crate_index//:ethnum",
        "@crate_index//:futures",
        "@crate_index//:futures-util",
        "@crate_index//:hex",
        "@crate_index//:http",
        "@crate_index//:http-body",
        "@crate_index//:humantime",
        "@crate_index//:ic-agent",
        "@crate_index//:ic-bn-lib",
        "@crate_index//:ic-bn-lib-common",
        "@crate_index//:ipnet",
        "@crate_index//:lazy_static",
        "@crate_index//:little-loadshedder",
        "@crate_index//:maxminddb",
        "@crate_index//:mockall",
        "@crate_index//:moka",
        "@crate_index//:nftables",
        "@crate_index//:nix",
        "@crate_index//:rand",
        "@crate_index//:ratelimit",
        "@crate_index//:rcgen",
        "@crate_index//:regex",
        "@crate_index//:reqwest",
        "@crate_index//:rustls",
        "@crate_index//:rustls-pemfile",
        "@crate_index//:serde",
        "@crate_index//:serde_bytes",
        "@crate_index//:serde_cbor",
        "@crate_index//:serde_json",
        "@crate_index//:serde_regex",
        "@crate_index//:serde_yaml",
        "@crate_index//:sha3",
        "@crate_index//:simple_moving_average",
        "@crate_index//:slog",
        "@crate_index//:strum",
        "@crate_index//:tempfile",
        "@crate_index//:thiserror",
        "@crate_index//:tikv-jemalloc-ctl",
        "@crate_index//:tikv-jemallocator",
        "@crate_index//:tokio",
        "@crate_index//:tokio-tungstenite",
        "@crate_index//:tokio-util",
        "@crate_index//:tower",
        "@crate_index//:tower-http",
        "@crate_index//:tower_governor",
        "@crate_index//:tracing",
        "@crate_index//:tracing-serde",
        "@crate_index//:tracing-slog",
        "@crate_index//:tracing-subscriber",
        "@crate_index//:url",
        "@crate_index//:x509-parser",
    ],
)

rust_library(
    name = "ic_boundary",
    srcs = glob(
        ["src/**"],
        exclude = ["src/main.rs"],
    ),
    proc_macro_deps = [
        # Keep sorted.
        "@crate_index//:async-trait",
        "@crate_index//:derive-new",
        "@crate_index//:indoc",
    ],
    version = VERSION,
    deps = [
        # Keep sorted.
        "//packages/ic-ed25519",
        "//rs/boundary_node/rate_limits/api:rate_limits_api",
        "//rs/boundary_node/salt_sharing/api:salt_sharing_api",
        "//rs/certification/test-utils",
        "//rs/config",
        "//rs/crypto",
        "//rs/crypto/tree_hash",
        "//rs/crypto/utils/basic_sig",
        "//rs/crypto/utils/threshold_sig_der",
        "//rs/crypto/utils/tls",
        "//rs/interfaces",
        "//rs/interfaces/registry",
        "//rs/limits",
        "//rs/monitoring/logger",
        "//rs/orchestrator/registry_replicator",
        "//rs/protobuf",
        "//rs/registry/fake",
        "//rs/registry/helpers",
        "//rs/registry/keys",
        "//rs/registry/proto_data_provider",
        "//rs/registry/routing_table",
        "//rs/registry/subnet_type",
        "//rs/types/base_types",
        "//rs/types/types",
        "@crate_index//:anyhow",
        "@crate_index//:arc-swap",
        "@crate_index//:axum",
        "@crate_index//:axum-extra",
        "@crate_index//:bytes",
        "@crate_index//:candid",
        "@crate_index//:clap",
        "@crate_index//:dashmap",
        "@crate_index//:ethnum",
        "@crate_index//:futures",
        "@crate_index//:futures-util",
        "@crate_index//:hex",
        "@crate_index//:http",
        "@crate_index//:http-body",
        "@crate_index//:humantime",
        "@crate_index//:ic-agent",
        "@crate_index//:ic-bn-lib",
        "@crate_index//:ic-bn-lib-common",
        "@crate_index//:ipnet",
        "@crate_index//:lazy_static",
        "@crate_index//:little-loadshedder",
        "@crate_index//:maxminddb",
        "@crate_index//:mockall",
        "@crate_index//:moka",
        "@crate_index//:nftables",
        "@crate_index//:nix",
        "@crate_index//:rand",
        "@crate_index//:ratelimit",
        "@crate_index//:rcgen",
        "@crate_index//:regex",
        "@crate_index//:reqwest",
        "@crate_index//:rustls",
        "@crate_index//:rustls-pemfile",
        "@crate_index//:serde",
        "@crate_index//:serde_bytes",
        "@crate_index//:serde_cbor",
        "@crate_index//:serde_json",
        "@crate_index//:serde_regex",
        "@crate_index//:serde_yaml",
        "@crate_index//:sha3",
        "@crate_index//:simple_moving_average",
        "@crate_index//:slog",
        "@crate_index//:strum",
        "@crate_index//:thiserror",
        "@crate_index//:tikv-jemalloc-ctl",
        "@crate_index//:tikv-jemallocator",
        "@crate_index//:tokio",
        "@crate_index//:tokio-tungstenite",
        "@crate_index//:tokio-util",
        "@crate_index//:tower",
        "@crate_index//:tower-http",
        "@crate_index//:tower_governor",
        "@crate_index//:tracing",
        "@crate_index//:tracing-serde",
        "@crate_index//:tracing-slog",
        "@crate_index//:tracing-subscriber",
        "@crate_index//:url",
        "@crate_index//:x509-parser",
    ],
)
